import {AgentRes} from "@/types/agentType";
import {KnowledgeBaseRes} from "@/types/knowledgeBaseType";
import {CollectionRes} from "@/types/collectionType";
import { SocketTask } from "@tarojs/taro";

// 消息内容的类型
export interface MessageContent {
  type: "text" | "image" | "progress";
  content: string;
}

// 单条聊天消息的类型
export interface ChatMessage {
  role: "user" | "system";  // 发送者角色：用户或系统
  contents: MessageContent[];  // 消息内容：包含多个 MessageContent
}


export interface Conservation {
    name: string;
}

export interface ConservationRes extends Conservation {
    id: number;
    uuid: string;
    user_uuid: string;
    agent_uuid: string;
    knowledge_base_uuid: string;
    collection_uuid: string;
    created_time: string;
    updated_time: string;
}

export interface ConservationDetail extends ConservationRes {
    agent: AgentRes;
    knowledge_base: KnowledgeBaseRes;
    collection: CollectionRes;
    chat_history: ChatMessage[];
    chat_parameters: {};
    short_memory: string;
    long_memory: string;
}

export interface ConservationPagination {
    items: Array<ConservationRes>;
    links: Array<string>;
    total: number;
    page: number;
    size: number;
    total_pages: number;
}

export interface GetAllConservationParam {
    agent_uuid?: string;
    user_uuid?: string;
}

export interface GetConservationListParam {
    page?: number;
    size?: number;
}

export interface ConservationCreateReq {
    name: string;
    agent_uuid: string;
}

export interface ConservationUpdateReq {
    name?: string;
    chat_history?: Array<any>;
    chat_parameters?: {};
    short_memory?: string;
    long_memory?: string;
}


export interface ConservationState {
    status: 'idle' | 'loading' | 'succeeded' | 'failed';
    generating: boolean;
    generatingTask: SocketTask | null;
    error: string | null;
    conservations: ConservationPagination;
    conservationDetail: ConservationDetail | null;
}
